package com.itheima.health.dao;

import com.itheima.health.pojo.OrderSetting;
import com.itheima.health.pojo.OrderSettingVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDate;
import java.util.Date;
import java.util.List;

@Mapper
public interface OrderSettingMapper {
    /**
     * 通过日期展示列表
     * @param date
     * @return
     */
    List<OrderSettingVO> getOrderSettingByMonth(String date);

    /**
     * 设置预约人数
     * @param orderSetting
     */
    void update(OrderSetting orderSetting);

    /**
     * 插入新参数
     * @param orderDate
     * @param number
     * @param reservations
     */
    @Insert("insert into t_ordersetting (orderDate,number,reservations) values (#{orderDate},#{number},#{reservations})")
    void insert(Date orderDate,Integer number,Integer reservations);

    /**
     * 通过日期查找
     * @param orderDate
     * @return
     */
    @Select("select * from t_ordersetting where orderDate = #{orderDate}")
    List<OrderSetting> getOrderSettingByDate(Date orderDate);

    /**
     * 获取当日预约信息
     * @param orderDate
     * @return
     */
    @Select("select * from t_ordersetting where orderDate = #{orderDate}")
    OrderSetting find(Date orderDate);
}
